RealtimeDictionary<TValue>
RealtimeDictionary<TValue>
RealtimeDictionary is a special model type that represents an dictionary of models. This collection can be modified by multiple clients simultaneously without introducing datastore conflicts. All updates are applied instantly and are rolled back if rejected by the server (due to ownership). Adding or removing items sends the minimal amount of information to the server in order to perform the update on all clients. The whole collection is not sent every time.
Events
event ModelAdded<TValue> modelAdded
An event that fires when a model is added locally or remotely.
event ModelReplaced<TValue> modelReplaced
An event that fires when a model is replaced locally or remotely.
A model is considered replaced (as opposed to removed and added) if a new model is added that overwrites an existing model under the same key.
event ModelRemoved<TValue> modelRemoved
An event that fires when a model is removed locally or remotely.
Properties
TValue Item { get; set; }
Access a model for a specific key.
int Count { get; }
The number of models currently stored in the collection.
Methods
void Add(uint key, TValue value)
Add a model to the collection.
bool Remove(uint key)
Remove a model from the collection.
A boolean to indicate whether the key was contained within the collection.
IEnumerator<KeyValuePair<uint, TValue>> GetEnumerator()
bool TryGetValue(uint key, TValue& value)
Attempt to retrieve a value from the collection.
This method will not throw an exception if the key is not found.
A boolean indicating whether the key was found within the collection.
bool ContainsKey(uint key)
Check if a key exists within the collection.
A boolean indicating whether the key was found within the collection.
bool ContainsValue(TValue value)
Check if a model instance is contained in the collection.
This method is very slow! If you need high performance value searching, you should use the added/replaced/removed events to mirror this collection to a faster collection type.
A boolean indicating whether the value was found within the collection.
uint GetCollectionTypeID()